home *** CD-ROM | disk | FTP | other *** search
- /*________________________________________________________
-
- File: Extension Seg2.c
-
- C code for a printing extension.
-
- Dave Hersey
- Apple Developer Technical Support
-
- 12/01/92 - dmh - Created.
- 4/26/93 - dmh - Updated to use recommended approach
- to global data initialization.
- 9/05/93 - dmh - Updated for b2.
- - Fixed minor problem with highlighting
- of editText panel items.
- - Switched to Exception.h assertion stuff
- for error checking.
- 12/18/93 - dmh - Updated for b3.
- 3/22/94 - dmh - Updated for b4.
- 6/10/94 - dmh - Added GXPRINTINGDISPATCH examples.
- 6/14/96 - cn - Updated to support Universal Interfaces 2.1.
-
- (Note: all functions are in the Mark menu.)
-
- __________________________________________________________*/
-
- #define SECOND_SEG
- #include "Extension.h"
- #undef SECOND_SEG
-
-
- /*******************************************************************
- SetUpPrintPanel sets up our print panel, adding a default
- ExtensionCollection item to the job collection. This
- collection item has the values we'll use to set up our panel's
- controls.
-
- ********************************************************************/
-
- OSErr SetUpPrintPanel()
- {
- OSErr err;
- gxPanelSetupRecord panelSetupRec;
- ExtensionCollection extConfig;
-
- // Try to find our collection item.
-
- err = GetCollectionItem(GXGetJobCollection(GXGetJob()),
- kExtensionCollectionType,
- gxPrintingTagID,
- nil,
- &extConfig);
-
-
- // If we don't have an item in the job collection yet, store our default
- // settings in it.
-
- if (err == collectionItemNotFoundErr)
- {
- extConfig.extTurnedOn = kDefaultSetting;
-
- err = AddCollectionItem(GXGetJobCollection(GXGetJob()),
- kExtensionCollectionType,
- gxPrintingTagID,
- sizeof(ExtensionCollection),
- &extConfig);
-
- nrequire(err, HaveCollectionMgrError);
- }
-
-
- // Now, set up the panel.
-
- panelSetupRec.panelResId = r_ExtensionPanel; // which panel resource?
- panelSetupRec.resourceRefNum = GXGetMessageHandlerResFile(); // where is it?
- panelSetupRec.refCon = 0; // we don't use this.
- panelSetupRec.panelKind = gxExtensionPanel; // This is an extension panel.
-
- err = GXSetupDialogPanel(&panelSetupRec);
-
-
- HaveCollectionMgrError:
-
- return err;
- }
-
-
- /*******************************************************************
- GetJobCollectionItem is a generic routine that retrieves a
- collection item from the job collection.
-
- ********************************************************************/
-
- OSErr GetJobCollectionItem(void *collectItem, long *collectSize,
- OSType collectType, short collectID)
- {
- return GetCollectionItem(GXGetJobCollection(GXGetJob()),
- collectType,
- collectID,
- collectSize,
- collectItem);
- }
-